import requests from './ajax'

export const fetchColumns = () => {
  return requests.get('/columns')
}
export const fetchColumn = (cid) => {
  return requests.get(`/columns/${cid}`)
}

export const fetchPosts = (cid) => {
  return requests.get(`/columns/${cid}/posts`)
}

export const reqLogin = (data) => {
  return requests({ url: '/user/login', method: 'post', data })
}

export const getUser = () => {
  return requests({ url: '/user/current' })
}
export const reqRegister = (data) => {
  return requests({ url: '/users', method: 'post', data })
}

export const reqCreatePost = (data) => {
  return requests({ url: '/posts', method: 'post', data })
}
